Skip to content

fix: resolve UnboundLocalError and eval assignment bug in load_available_input_data#49

Open
RohitMurali18 wants to merge 1 commit intoNVlabs:mainfrom
RohitMurali18:fix/data-cam-k-bugs
Open

fix: resolve UnboundLocalError and eval assignment bug in load_available_input_data#49
RohitMurali18 wants to merge 1 commit intoNVlabs:mainfrom
RohitMurali18:fix/data-cam-k-bugs

Conversation

@RohitMurali18
Copy link
Copy Markdown

Bug Fixes

1. UnboundLocalError when K is None and file has no 'K' key

cam_K was referenced before assignment in the case where K=None
and the loaded .npy file doesn't contain a 'K' key.
Fixed by initializing cam_K = None at the top of the block.

2. eval(K) result discarded — np.array(K).reshape(3,3) fails on raw string

eval(K) was called but assigned to cam_K instead of back to K,
so the subsequent np.array(K).reshape(3,3) was still operating on
the original string. Fixed by assigning eval(K) back to K.

Impact

Both bugs cause silent or hard crashes during data loading,
particularly when running inference on custom camera setups.

1. Initialize cam_K to None so the function doesn't raise
   UnboundLocalError when K is None and the loaded file has no 'K' key.

2. Assign eval(K) back to K (not cam_K) so the subsequent
   np.array(K).reshape(3,3) operates on the parsed list instead of
   the original string, which would fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant